const express =require('express')

const app = express()
app.use(express.json())
app.use(express.urlencoded({extended:true}))
app.use(express.static('wwwroot'))

app.all('*', function (req, res, next) {
    res.header("Access-Control-Allow-Origin", "*");
    res.header("Access-Control-Allow-Headers", "X-Requested-With,Content-Type");
    res.header("Access-Control-Allow-Methods", "PUT,POST,GET,DELETE,OPTIONS");
    res.header("Cache-Control", "no-store");
    next();
});

const db = require('./modules/db')
const User = db.User

app.use('/user',require('./router/user'))
app.use('/view', require('./router/views'))


app.listen(3030,()=>console.log('服务器开启中....'))